package com.mengfou.appserver.app;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;

import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

/**
 * @author 梦否 on 2024/1/5
 * @blog https://mengfou.blog.csdn.net/
 */
public class PermissionUtil {

    public static boolean hasPermission(Context context, String permissionStr) {
        return ContextCompat.checkSelfPermission(context, permissionStr) != PackageManager.PERMISSION_GRANTED;
    }

    public static void requestPermission(Activity activity, String permissionStr, int requestCode) {
        ActivityCompat.requestPermissions(activity, new String[]{permissionStr}, requestCode);
    }

}
